/**
 * ...
 * @author HTML5
 */

function AnimationManager() {}


AnimationManager._instance = null;
AnimationManager.getInstance = function()
{
	if( AnimationManager._instance == null )
	{
		AnimationManager._instance = new AnimationManager();
		AnimationManager._instance.init();
	}
	
	
	return AnimationManager._instance;
};



AnimationManager.prototype._animations = null;


AnimationManager.prototype.init = function()
{
	this._animations = new Object();
};

AnimationManager.prototype.registerAnimation = function( p_animation, p_animationId )
{
	this._animations[p_animationId] = p_animation;
};

AnimationManager.prototype.getAnimationById = function( p_animationId )
{
	return this._animations[p_animationId];
};

AnimationManager.prototype.removeAnimationById = function( p_animationId )
{
	if( this._animations[p_animationId] )
	{
		delete this._animations[p_animationId];
	}
};

AnimationManager.prototype.animateAll = function()
{
	var prop = null;
	var anim = null;
	var time = new Date().getTime();
	
	for( prop in this._animations )
	{
		anim = this._animations[prop];
		anim.animate(time);
	}
};


AnimationManager.prototype.destroy = function()
{
	AnimationManager._instance = null;
	this._animations = null;
};









